Exercise 1: Changing Text Content
- Create an HTML page with a
<p>
element that has some initial text content. - Write JavaScript code that changes the text content of the
<p>
element when a button is clicked.
Exercise 2: Changing Styles
- Create an HTML page with a button and a
<div>
element. - Write JavaScript code that changes the background color of the
<div>
element when the button is clicked.
Exercise 3: Adding Elements
- Create an HTML page with an empty unordered list (
<ul>
) and a button. - Write JavaScript code that adds list items (
<li>
) to the unordered list when the button is clicked.
Exercise 4: Removing Elements
- Create an HTML page with a list of items (e.g., a
<ul>
with several<li>
elements) and a button. - Write JavaScript code that removes a list item when the button is clicked.
Exercise 5: Creating a To-Do List
- Create an HTML page with an input field, a button, and an unordered list.
- Write JavaScript code that allows users to enter tasks in the input field and adds them as list items when the button is clicked. Additionally, add a feature to mark tasks as complete or delete them.